/**
 * 
 */
package com.locky.ws;

import javax.persistence.EntityManager;




import com.locky.jpaUtils.*;


/** 
 * @author virgil
 */
public class AutorisationDAO {
	
	public boolean isEmpty(){
		EntityManager entityManager=JPAUtil.getEntityManager();
		if (entityManager.createNamedQuery("findAllAutorisations").getResultList().isEmpty())
			return true;
		else
			return false;	
	}

	public boolean add(Autorisation autorisation){
		EntityManager entityManager=JPAUtil.getEntityManager();
	try{
			entityManager.persist(autorisation);
		} catch (Exception e) {
			System.err.println("Problem when saving");
			e.printStackTrace();
			return false;
		}
		return true;
	}
}

